package com.threeti.mecool.core.infrastructure.persistence.project;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.threeti.mecool.core.domain.model.project.ProjectProduct;

/** TODO jay:this public repo may damage the aggregationroot(project) constraints*/
public interface ProjectProductRepository extends JpaRepository<ProjectProduct, Long> {
  @Modifying
  @Transactional
  @Query("delete from ProjectProduct pp where pp.project.id = ?1")    
  void deleteByProjectId(Long projectId);
}
